package com.kaibo.roomdemo.data.db.dao

import android.arch.persistence.room.Dao
import android.arch.persistence.room.Insert
import android.arch.persistence.room.OnConflictStrategy
import android.arch.persistence.room.Query
import com.kaibo.roomdemo.data.db.entity.BookEntity
import io.reactivex.Flowable
import io.reactivex.Observable

/**
 * @author Administrator
 * @date 2018/2/7 0007 下午 3:30
 * GitHub：
 * email：
 * description：
 */

@Dao
interface BookDao {

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertBook(bookEntity: BookEntity): Long

    @Query("SELECT * FROM books WHERE user_id = :userId")
    fun findBookByUserId(userId: Long): Flowable<BookEntity>

}